﻿@using Website.CRUDServices
@model DefaultSearchFields
@{
    List<Project> Projects = this.ViewData["Projects"] as List<Project> ?? new List<Project>();
}
@if (this.Model != null)
{
    if (this.Model.HappenedAfter.HasValue)
    {
        <tr><td>Fra:</td><td>@string.Format("{0:dd-MM-yyyy}", this.Model.HappenedAfter.Value)</td></tr>
    }

    if (this.Model.HappenedBefore.HasValue)
    {
        <tr><td>Til:</td><td>@string.Format("{0:dd-MM-yyyy}", this.Model.HappenedBefore.Value)</td></tr>
    }

    if ((this.Model.OwnerProjects ?? new Guid[0]).Any())
    {
        <tr><td>Projekt(er):</td>
            <td>
                @foreach (Project project in Projects.Where(x => this.Model.OwnerProjects.Contains(x.ID)).OrderBy(x => x.Name))
                {
                    @project.Name
                    <br />
                }
            </td>
        </tr>
    }
}